{include file="common/head"}
<head>
<title>货车修改</title>

<style type="text/css">
  #top{background: #f60;opacity: 1;}
  #content{background-color:#fff;border-radius: 10px;padding: 10px;border: 1px solid #555;}
</style>        
</head>
<body style="background: #f60;">
    <div class="container-fluid" style="max-width: 600px;"  >

    <div id="top" class="row" class="text-center" style="color:white;">
        <div class="col-2 text-center" style="padding: 0;">
            <span class="bi-chevron-left btn-back"></span>
        </div>
        <div class="col-8 text-center">我的货车资料</div>
        <div class="col-2 text-center" style="padding: 0;">
            <!-- <span class="bi-arrow-clockwise"></span> -->
        </div>
    </div>
    <div style="height:60px;"></div>

    <div id="content">
    <form method="post" enctype="multipart/form-data" action="/index.php/truck/edit">   
        <input type="hidden" name="id" value="{$data.id}" />
      <div class="mb-3">
        <label for="brand" class="form-label">品牌(Brand):</label>
        <input type="text" class="form-control" id="brand" name="brand" value="{$data.brand}" placeholder="" />
      </div>       
      <div class="mb-3 mt-3">
        <lable for="cat" class="form-label">所属分类(Categray):</label>
        <select id="cat" name="cat" class="form-control">
            {foreach $category as $k=>$v}
                {if $k==$data.cat}
                    <option value="{$k}" selected >{$v['name']}</option>
                {else}
                    <option value="{$k}" >{$v['name']}</option>
                {/if}
            {/foreach}
        </select>
      </div>
      <div class="mb-3 mt-3">
        <lable for="name" class="form-label">名称(Chinese Name):</label>
        <input type="text" class="form-control" id="name" name="name" value="{$data.name}" placeholder="" />
      </div>
      <div class="mb-3 mt-3">
        <lable for="name2" class="form-label">Khmer Name:</label>
        <input type="text" class="form-control" id="name2" name="name2" value="{$data.name2}" placeholder="" />
      </div>      
      <div class="mb-3">
        <label for="name3" class="form-label">English Name:</label>
        <input type="text" class="form-control" id="name3" name="name3" value="{$data.name3}" placeholder="" />
      </div>

      
      <div class="mb-3 text-center">
        <img id="img" src="{$data.imgs}" style="width:90px;min-width: 90px;min-height: 30px;border: 1px solid #ccc;margin:0 auto;" alt="Image" />
        <input type="file"  name="file" id="file" style="display: none;" /> <br> 
       </div>

      <button  type="button" class="form-control btn btn-primary" onclick="do_save()"  >保存(Save)</button>
    </form>
    <br/>
      <div class="mb3 text-center">
        {if $data.status==1}你的车可以接单。{else}你的车还不能接单,请联系客服！{/if}
      </div>    
    </div>
    </div>

<script type="text/javascript">
    function do_save(){
      $("form").submit();
    } 
$(document).ready(function(){
    
    $(".btn-back").on('click',function(){
        window.history.back();
    })    
    $("#img").on('click',function(e){
        $("#file").trigger('click');
    })
    $("#file").on('change',function(e){
        console.log($(this));
        $(this).show();

    })
   
})

</script>


</body>
</html>
